{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 10 Minutes to pandas\n",
    "请参阅[官方文档](http://pandas.pydata.org/pandas-docs/stable/10min.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 设置为 inline 风格\n",
    "%matplotlib inline\n",
    "# 包导入\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据整形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>first</th>\n",
       "      <th>second</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">bar</th>\n",
       "      <th>one</th>\n",
       "      <td>0.072026</td>\n",
       "      <td>0.422077</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-1.099181</td>\n",
       "      <td>-0.354796</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">baz</th>\n",
       "      <th>one</th>\n",
       "      <td>1.285500</td>\n",
       "      <td>-1.185525</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>0.645316</td>\n",
       "      <td>-0.660115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">foo</th>\n",
       "      <th>one</th>\n",
       "      <td>0.696443</td>\n",
       "      <td>-1.664527</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>0.718399</td>\n",
       "      <td>-0.154125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">qux</th>\n",
       "      <th>one</th>\n",
       "      <td>-0.740052</td>\n",
       "      <td>0.713089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-0.672748</td>\n",
       "      <td>-1.346843</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     A         B\n",
       "first second                    \n",
       "bar   one     0.072026  0.422077\n",
       "      two    -1.099181 -0.354796\n",
       "baz   one     1.285500 -1.185525\n",
       "      two     0.645316 -0.660115\n",
       "foo   one     0.696443 -1.664527\n",
       "      two     0.718399 -0.154125\n",
       "qux   one    -0.740052  0.713089\n",
       "      two    -0.672748 -1.346843"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tuples = list(zip(*[['bar', 'bar', 'baz', 'baz',\n",
    "                     'foo', 'foo', 'qux', 'qux'],\n",
    "                    ['one', 'two', 'one', 'two',\n",
    "                     'one', 'two', 'one', 'two']]))\n",
    "index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])\n",
    "df = pd.DataFrame(np.random.randn(8, 2), index=index, columns=['A', 'B'])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>second</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>one</th>\n",
       "      <td>0.072026</td>\n",
       "      <td>0.422077</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-1.099181</td>\n",
       "      <td>-0.354796</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               A         B\n",
       "second                    \n",
       "one     0.072026  0.422077\n",
       "two    -1.099181 -0.354796"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc['bar']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "A    0.072026\n",
       "B    0.422077\n",
       "Name: one, dtype: float64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc['bar'].loc['one']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "first  second   \n",
       "bar    one     A    0.072026\n",
       "               B    0.422077\n",
       "       two     A   -1.099181\n",
       "               B   -0.354796\n",
       "baz    one     A    1.285500\n",
       "               B   -1.185525\n",
       "       two     A    0.645316\n",
       "               B   -0.660115\n",
       "foo    one     A    0.696443\n",
       "               B   -1.664527\n",
       "       two     A    0.718399\n",
       "               B   -0.154125\n",
       "qux    one     A   -0.740052\n",
       "               B    0.713089\n",
       "       two     A   -0.672748\n",
       "               B   -1.346843\n",
       "dtype: float64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stacked = df.stack()\n",
    "stacked"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.072026163089430537"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stacked.loc['bar'].loc['one'].loc['A']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>first</th>\n",
       "      <th>second</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">bar</th>\n",
       "      <th>one</th>\n",
       "      <td>0.072026</td>\n",
       "      <td>0.422077</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-1.099181</td>\n",
       "      <td>-0.354796</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">baz</th>\n",
       "      <th>one</th>\n",
       "      <td>1.285500</td>\n",
       "      <td>-1.185525</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>0.645316</td>\n",
       "      <td>-0.660115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">foo</th>\n",
       "      <th>one</th>\n",
       "      <td>0.696443</td>\n",
       "      <td>-1.664527</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>0.718399</td>\n",
       "      <td>-0.154125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">qux</th>\n",
       "      <th>one</th>\n",
       "      <td>-0.740052</td>\n",
       "      <td>0.713089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-0.672748</td>\n",
       "      <td>-1.346843</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     A         B\n",
       "first second                    \n",
       "bar   one     0.072026  0.422077\n",
       "      two    -1.099181 -0.354796\n",
       "baz   one     1.285500 -1.185525\n",
       "      two     0.645316 -0.660115\n",
       "foo   one     0.696443 -1.664527\n",
       "      two     0.718399 -0.154125\n",
       "qux   one    -0.740052  0.713089\n",
       "      two    -0.672748 -1.346843"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stacked.unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">A</th>\n",
       "      <th colspan=\"2\" halign=\"left\">B</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>second</th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>first</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>bar</th>\n",
       "      <td>0.072026</td>\n",
       "      <td>-1.099181</td>\n",
       "      <td>0.422077</td>\n",
       "      <td>-0.354796</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>baz</th>\n",
       "      <td>1.285500</td>\n",
       "      <td>0.645316</td>\n",
       "      <td>-1.185525</td>\n",
       "      <td>-0.660115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>foo</th>\n",
       "      <td>0.696443</td>\n",
       "      <td>0.718399</td>\n",
       "      <td>-1.664527</td>\n",
       "      <td>-0.154125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>qux</th>\n",
       "      <td>-0.740052</td>\n",
       "      <td>-0.672748</td>\n",
       "      <td>0.713089</td>\n",
       "      <td>-1.346843</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               A                   B          \n",
       "second       one       two       one       two\n",
       "first                                         \n",
       "bar     0.072026 -1.099181  0.422077 -0.354796\n",
       "baz     1.285500  0.645316 -1.185525 -0.660115\n",
       "foo     0.696443  0.718399 -1.664527 -0.154125\n",
       "qux    -0.740052 -0.672748  0.713089 -1.346843"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stacked.unstack().unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>second</th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>first</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">bar</th>\n",
       "      <th>A</th>\n",
       "      <td>0.072026</td>\n",
       "      <td>-1.099181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>0.422077</td>\n",
       "      <td>-0.354796</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">baz</th>\n",
       "      <th>A</th>\n",
       "      <td>1.285500</td>\n",
       "      <td>0.645316</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>-1.185525</td>\n",
       "      <td>-0.660115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">foo</th>\n",
       "      <th>A</th>\n",
       "      <td>0.696443</td>\n",
       "      <td>0.718399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>-1.664527</td>\n",
       "      <td>-0.154125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">qux</th>\n",
       "      <th>A</th>\n",
       "      <td>-0.740052</td>\n",
       "      <td>-0.672748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>0.713089</td>\n",
       "      <td>-1.346843</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "second        one       two\n",
       "first                      \n",
       "bar   A  0.072026 -1.099181\n",
       "      B  0.422077 -0.354796\n",
       "baz   A  1.285500  0.645316\n",
       "      B -1.185525 -0.660115\n",
       "foo   A  0.696443  0.718399\n",
       "      B -1.664527 -0.154125\n",
       "qux   A -0.740052 -0.672748\n",
       "      B  0.713089 -1.346843"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stacked.unstack(1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据透视表\n",
    "\n",
    "pivot table/轴向旋转表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>one</td>\n",
       "      <td>A</td>\n",
       "      <td>foo</td>\n",
       "      <td>1.477533</td>\n",
       "      <td>1.557713</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>one</td>\n",
       "      <td>B</td>\n",
       "      <td>foo</td>\n",
       "      <td>0.019528</td>\n",
       "      <td>2.483014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>two</td>\n",
       "      <td>C</td>\n",
       "      <td>foo</td>\n",
       "      <td>-0.912452</td>\n",
       "      <td>0.409732</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>three</td>\n",
       "      <td>A</td>\n",
       "      <td>bar</td>\n",
       "      <td>0.502807</td>\n",
       "      <td>-0.462401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>one</td>\n",
       "      <td>B</td>\n",
       "      <td>bar</td>\n",
       "      <td>1.709597</td>\n",
       "      <td>-1.739413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>one</td>\n",
       "      <td>C</td>\n",
       "      <td>bar</td>\n",
       "      <td>-0.658155</td>\n",
       "      <td>1.302735</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>two</td>\n",
       "      <td>A</td>\n",
       "      <td>foo</td>\n",
       "      <td>0.007806</td>\n",
       "      <td>0.782926</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>three</td>\n",
       "      <td>B</td>\n",
       "      <td>foo</td>\n",
       "      <td>-0.067922</td>\n",
       "      <td>-0.193820</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>one</td>\n",
       "      <td>C</td>\n",
       "      <td>foo</td>\n",
       "      <td>0.806713</td>\n",
       "      <td>0.383870</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>one</td>\n",
       "      <td>A</td>\n",
       "      <td>bar</td>\n",
       "      <td>0.794017</td>\n",
       "      <td>0.749756</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>two</td>\n",
       "      <td>B</td>\n",
       "      <td>bar</td>\n",
       "      <td>-0.532554</td>\n",
       "      <td>-0.811900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>three</td>\n",
       "      <td>C</td>\n",
       "      <td>bar</td>\n",
       "      <td>0.464731</td>\n",
       "      <td>1.168423</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        A  B    C         D         E\n",
       "0     one  A  foo  1.477533  1.557713\n",
       "1     one  B  foo  0.019528  2.483014\n",
       "2     two  C  foo -0.912452  0.409732\n",
       "3   three  A  bar  0.502807 -0.462401\n",
       "4     one  B  bar  1.709597 -1.739413\n",
       "5     one  C  bar -0.658155  1.302735\n",
       "6     two  A  foo  0.007806  0.782926\n",
       "7   three  B  foo -0.067922 -0.193820\n",
       "8     one  C  foo  0.806713  0.383870\n",
       "9     one  A  bar  0.794017  0.749756\n",
       "10    two  B  bar -0.532554 -0.811900\n",
       "11  three  C  bar  0.464731  1.168423"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({'A' : ['one', 'one', 'two', 'three'] * 3,\n",
    "                    'B' : ['A', 'B', 'C'] * 4,\n",
    "                    'C' : ['foo', 'foo', 'foo', 'bar', 'bar', 'bar'] * 2,\n",
    "                    'D' : np.random.randn(12),\n",
    "                    'E' : np.random.randn(12)})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>C</th>\n",
       "      <th>bar</th>\n",
       "      <th>foo</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">one</th>\n",
       "      <th>A</th>\n",
       "      <td>0.794017</td>\n",
       "      <td>1.477533</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>1.709597</td>\n",
       "      <td>0.019528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>-0.658155</td>\n",
       "      <td>0.806713</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">three</th>\n",
       "      <th>A</th>\n",
       "      <td>0.502807</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>NaN</td>\n",
       "      <td>-0.067922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>0.464731</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">two</th>\n",
       "      <th>A</th>\n",
       "      <td>NaN</td>\n",
       "      <td>0.007806</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>-0.532554</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>NaN</td>\n",
       "      <td>-0.912452</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "C             bar       foo\n",
       "A     B                    \n",
       "one   A  0.794017  1.477533\n",
       "      B  1.709597  0.019528\n",
       "      C -0.658155  0.806713\n",
       "three A  0.502807       NaN\n",
       "      B       NaN -0.067922\n",
       "      C  0.464731       NaN\n",
       "two   A       NaN  0.007806\n",
       "      B -0.532554       NaN\n",
       "      C       NaN -0.912452"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df, values='D', index=['A', 'B'], columns=['C'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">E</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <th>bar</th>\n",
       "      <th>foo</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>one</th>\n",
       "      <td>0.104360</td>\n",
       "      <td>1.474866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>three</th>\n",
       "      <td>0.353011</td>\n",
       "      <td>-0.193820</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>two</th>\n",
       "      <td>-0.811900</td>\n",
       "      <td>0.596329</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              E          \n",
       "C           bar       foo\n",
       "A                        \n",
       "one    0.104360  1.474866\n",
       "three  0.353011 -0.193820\n",
       "two   -0.811900  0.596329"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df, values=['E'], index=['A'], columns=['C'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>D</th>\n",
       "      <th>E</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>bar</th>\n",
       "      <td>0.615153</td>\n",
       "      <td>0.104360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>foo</th>\n",
       "      <td>0.767925</td>\n",
       "      <td>1.474866</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            D         E\n",
       "C                      \n",
       "bar  0.615153  0.104360\n",
       "foo  0.767925  1.474866"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df.A=='one'].groupby('C').mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### 时间序列\n",
    "\n",
    "pandas 提供了强大的时间序列功能，比如把秒级的股票数据转换为5分钟周期数据等。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2016-03-01 00:00:00', '2016-03-01 00:00:01',\n",
       "               '2016-03-01 00:00:02', '2016-03-01 00:00:03',\n",
       "               '2016-03-01 00:00:04', '2016-03-01 00:00:05',\n",
       "               '2016-03-01 00:00:06', '2016-03-01 00:00:07',\n",
       "               '2016-03-01 00:00:08', '2016-03-01 00:00:09',\n",
       "               ...\n",
       "               '2016-03-01 00:09:50', '2016-03-01 00:09:51',\n",
       "               '2016-03-01 00:09:52', '2016-03-01 00:09:53',\n",
       "               '2016-03-01 00:09:54', '2016-03-01 00:09:55',\n",
       "               '2016-03-01 00:09:56', '2016-03-01 00:09:57',\n",
       "               '2016-03-01 00:09:58', '2016-03-01 00:09:59'],\n",
       "              dtype='datetime64[ns]', length=600, freq='S')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rng = pd.date_range('20160301', periods=600, freq='s')\n",
    "rng"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01 00:00:00     34\n",
       "2016-03-01 00:00:01      4\n",
       "2016-03-01 00:00:02    382\n",
       "2016-03-01 00:00:03    164\n",
       "2016-03-01 00:00:04    178\n",
       "2016-03-01 00:00:05    421\n",
       "2016-03-01 00:00:06     34\n",
       "2016-03-01 00:00:07     71\n",
       "2016-03-01 00:00:08    316\n",
       "2016-03-01 00:00:09    201\n",
       "2016-03-01 00:00:10    214\n",
       "2016-03-01 00:00:11    443\n",
       "2016-03-01 00:00:12    185\n",
       "2016-03-01 00:00:13     79\n",
       "2016-03-01 00:00:14     38\n",
       "2016-03-01 00:00:15    465\n",
       "2016-03-01 00:00:16    309\n",
       "2016-03-01 00:00:17     93\n",
       "2016-03-01 00:00:18     20\n",
       "2016-03-01 00:00:19    338\n",
       "2016-03-01 00:00:20    149\n",
       "2016-03-01 00:00:21     34\n",
       "2016-03-01 00:00:22    257\n",
       "2016-03-01 00:00:23    462\n",
       "2016-03-01 00:00:24     41\n",
       "2016-03-01 00:00:25    471\n",
       "2016-03-01 00:00:26    313\n",
       "2016-03-01 00:00:27    224\n",
       "2016-03-01 00:00:28     78\n",
       "2016-03-01 00:00:29    498\n",
       "                      ... \n",
       "2016-03-01 00:09:30     61\n",
       "2016-03-01 00:09:31    315\n",
       "2016-03-01 00:09:32    388\n",
       "2016-03-01 00:09:33    391\n",
       "2016-03-01 00:09:34    263\n",
       "2016-03-01 00:09:35     11\n",
       "2016-03-01 00:09:36     61\n",
       "2016-03-01 00:09:37    400\n",
       "2016-03-01 00:09:38    109\n",
       "2016-03-01 00:09:39    135\n",
       "2016-03-01 00:09:40    267\n",
       "2016-03-01 00:09:41    248\n",
       "2016-03-01 00:09:42    469\n",
       "2016-03-01 00:09:43    155\n",
       "2016-03-01 00:09:44    284\n",
       "2016-03-01 00:09:45    168\n",
       "2016-03-01 00:09:46    228\n",
       "2016-03-01 00:09:47    244\n",
       "2016-03-01 00:09:48    442\n",
       "2016-03-01 00:09:49    450\n",
       "2016-03-01 00:09:50    226\n",
       "2016-03-01 00:09:51    370\n",
       "2016-03-01 00:09:52    192\n",
       "2016-03-01 00:09:53    325\n",
       "2016-03-01 00:09:54     82\n",
       "2016-03-01 00:09:55    154\n",
       "2016-03-01 00:09:56    285\n",
       "2016-03-01 00:09:57     22\n",
       "2016-03-01 00:09:58     48\n",
       "2016-03-01 00:09:59    171\n",
       "Freq: S, dtype: int32"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts = pd.Series(np.random.randint(0, 500, len(rng)), index=rng)\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01 00:00:00    28595\n",
       "2016-03-01 00:02:00    29339\n",
       "2016-03-01 00:04:00    28991\n",
       "2016-03-01 00:06:00    30789\n",
       "2016-03-01 00:08:00    30131\n",
       "Freq: 2T, dtype: int32"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.resample('2Min', how='sum')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "时区表达与转换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01    1.048036\n",
       "2016-03-02   -1.232093\n",
       "2016-03-03    0.519777\n",
       "2016-03-04    0.213931\n",
       "2016-03-05    0.184069\n",
       "Freq: D, dtype: float64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rng = pd.date_range('20160301', periods=5, freq='D')\n",
    "ts = pd.Series(np.random.randn(len(rng)), rng)\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01 00:00:00+00:00    1.048036\n",
       "2016-03-02 00:00:00+00:00   -1.232093\n",
       "2016-03-03 00:00:00+00:00    0.519777\n",
       "2016-03-04 00:00:00+00:00    0.213931\n",
       "2016-03-05 00:00:00+00:00    0.184069\n",
       "Freq: D, dtype: float64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts_utc = ts.tz_localize('UTC')\n",
    "ts_utc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01 08:00:00+08:00    1.048036\n",
       "2016-03-02 08:00:00+08:00   -1.232093\n",
       "2016-03-03 08:00:00+08:00    0.519777\n",
       "2016-03-04 08:00:00+08:00    0.213931\n",
       "2016-03-05 08:00:00+08:00    0.184069\n",
       "Freq: D, dtype: float64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts_utc.tz_convert('Asia/Shanghai')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在不同的时间表达方式间转换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-31    1.869095\n",
       "2016-04-30   -0.698419\n",
       "2016-05-31   -0.796308\n",
       "2016-06-30   -1.624937\n",
       "2016-07-31    0.118491\n",
       "Freq: M, dtype: float64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rng = pd.date_range('20160301', periods=5, freq='M')\n",
    "ts = pd.Series(np.random.randn(len(rng)), index=rng)\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03    1.869095\n",
       "2016-04   -0.698419\n",
       "2016-05   -0.796308\n",
       "2016-06   -1.624937\n",
       "2016-07    0.118491\n",
       "Freq: M, dtype: float64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ps = ts.to_period()\n",
    "ps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2016-03-01    1.869095\n",
       "2016-04-01   -0.698419\n",
       "2016-05-01   -0.796308\n",
       "2016-06-01   -1.624937\n",
       "2016-07-01    0.118491\n",
       "Freq: MS, dtype: float64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ps.to_timestamp()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PeriodIndex(['1990Q1', '1990Q2', '1990Q3', '1990Q4', '1991Q1', '1991Q2',\n",
       "             '1991Q3', '1991Q4', '1992Q1', '1992Q2', '1992Q3', '1992Q4',\n",
       "             '1993Q1', '1993Q2', '1993Q3', '1993Q4', '1994Q1', '1994Q2',\n",
       "             '1994Q3', '1994Q4', '1995Q1', '1995Q2', '1995Q3', '1995Q4',\n",
       "             '1996Q1', '1996Q2', '1996Q3', '1996Q4', '1997Q1', '1997Q2',\n",
       "             '1997Q3', '1997Q4', '1998Q1', '1998Q2', '1998Q3', '1998Q4',\n",
       "             '1999Q1', '1999Q2', '1999Q3', '1999Q4', '2000Q1', '2000Q2',\n",
       "             '2000Q3', '2000Q4'],\n",
       "            dtype='int64', freq='Q-NOV')"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prng = pd.period_range('1990Q1', '2000Q4', freq='Q-NOV')\n",
    "prng"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1990Q1    0.403397\n",
       "1990Q2    0.052607\n",
       "1990Q3    0.683487\n",
       "1990Q4   -0.871958\n",
       "1991Q1    0.860426\n",
       "1991Q2   -1.203006\n",
       "1991Q3   -0.190948\n",
       "1991Q4   -1.722338\n",
       "1992Q1    0.093187\n",
       "1992Q2   -1.732760\n",
       "1992Q3   -0.039225\n",
       "1992Q4    1.814737\n",
       "1993Q1   -0.201548\n",
       "1993Q2   -0.550538\n",
       "1993Q3   -0.409734\n",
       "1993Q4   -0.615150\n",
       "1994Q1    1.207771\n",
       "1994Q2   -0.002279\n",
       "1994Q3    0.105491\n",
       "1994Q4   -0.182737\n",
       "1995Q1   -0.083805\n",
       "1995Q2    0.174109\n",
       "1995Q3    0.742054\n",
       "1995Q4    0.620141\n",
       "1996Q1   -0.471295\n",
       "1996Q2   -1.926356\n",
       "1996Q3   -0.631435\n",
       "1996Q4   -0.218897\n",
       "1997Q1   -1.792132\n",
       "1997Q2    0.844161\n",
       "1997Q3   -0.745867\n",
       "1997Q4    0.887393\n",
       "1998Q1    0.558465\n",
       "1998Q2    0.523789\n",
       "1998Q3    0.844993\n",
       "1998Q4    1.329418\n",
       "1999Q1   -1.554542\n",
       "1999Q2    1.627259\n",
       "1999Q3    1.569094\n",
       "1999Q4    0.035025\n",
       "2000Q1    1.668087\n",
       "2000Q2   -0.845356\n",
       "2000Q3    0.633963\n",
       "2000Q4   -0.155322\n",
       "Freq: Q-NOV, dtype: float64"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts = pd.Series(np.random.randn(len(prng)), prng)\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PeriodIndex(['1990Q1', '1990Q2', '1990Q3', '1990Q4', '1991Q1', '1991Q2',\n",
       "             '1991Q3', '1991Q4', '1992Q1', '1992Q2', '1992Q3', '1992Q4',\n",
       "             '1993Q1', '1993Q2', '1993Q3', '1993Q4', '1994Q1', '1994Q2',\n",
       "             '1994Q3', '1994Q4', '1995Q1', '1995Q2', '1995Q3', '1995Q4',\n",
       "             '1996Q1', '1996Q2', '1996Q3', '1996Q4', '1997Q1', '1997Q2',\n",
       "             '1997Q3', '1997Q4', '1998Q1', '1998Q2', '1998Q3', '1998Q4',\n",
       "             '1999Q1', '1999Q2', '1999Q3', '1999Q4', '2000Q1', '2000Q2',\n",
       "             '2000Q3', '2000Q4'],\n",
       "            dtype='int64', freq='Q-NOV')"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1990-03-01 09:00    0.403397\n",
       "1990-06-01 09:00    0.052607\n",
       "1990-09-01 09:00    0.683487\n",
       "1990-12-01 09:00   -0.871958\n",
       "1991-03-01 09:00    0.860426\n",
       "1991-06-01 09:00   -1.203006\n",
       "1991-09-01 09:00   -0.190948\n",
       "1991-12-01 09:00   -1.722338\n",
       "1992-03-01 09:00    0.093187\n",
       "1992-06-01 09:00   -1.732760\n",
       "1992-09-01 09:00   -0.039225\n",
       "1992-12-01 09:00    1.814737\n",
       "1993-03-01 09:00   -0.201548\n",
       "1993-06-01 09:00   -0.550538\n",
       "1993-09-01 09:00   -0.409734\n",
       "1993-12-01 09:00   -0.615150\n",
       "1994-03-01 09:00    1.207771\n",
       "1994-06-01 09:00   -0.002279\n",
       "1994-09-01 09:00    0.105491\n",
       "1994-12-01 09:00   -0.182737\n",
       "1995-03-01 09:00   -0.083805\n",
       "1995-06-01 09:00    0.174109\n",
       "1995-09-01 09:00    0.742054\n",
       "1995-12-01 09:00    0.620141\n",
       "1996-03-01 09:00   -0.471295\n",
       "1996-06-01 09:00   -1.926356\n",
       "1996-09-01 09:00   -0.631435\n",
       "1996-12-01 09:00   -0.218897\n",
       "1997-03-01 09:00   -1.792132\n",
       "1997-06-01 09:00    0.844161\n",
       "1997-09-01 09:00   -0.745867\n",
       "1997-12-01 09:00    0.887393\n",
       "1998-03-01 09:00    0.558465\n",
       "1998-06-01 09:00    0.523789\n",
       "1998-09-01 09:00    0.844993\n",
       "1998-12-01 09:00    1.329418\n",
       "1999-03-01 09:00   -1.554542\n",
       "1999-06-01 09:00    1.627259\n",
       "1999-09-01 09:00    1.569094\n",
       "1999-12-01 09:00    0.035025\n",
       "2000-03-01 09:00    1.668087\n",
       "2000-06-01 09:00   -0.845356\n",
       "2000-09-01 09:00    0.633963\n",
       "2000-12-01 09:00   -0.155322\n",
       "Freq: H, dtype: float64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.index = (prng.asfreq('M', 'e') + 1).asfreq('H', 's') + 9\n",
    "ts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 类别数据\n",
    "\n",
    "Categorical 是 pandas 0.15 版本才加入的新功能。用来表达类别数据。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>raw_grade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>e</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id raw_grade\n",
       "0   1         a\n",
       "1   2         b\n",
       "2   3         b\n",
       "3   4         a\n",
       "4   5         a\n",
       "5   6         e"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({\"id\":[1,2,3,4,5,6], \"raw_grade\":['a', 'b', 'b', 'a', 'a', 'e']})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>raw_grade</th>\n",
       "      <th>grade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "      <td>b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>b</td>\n",
       "      <td>b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>a</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>a</td>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>e</td>\n",
       "      <td>e</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id raw_grade grade\n",
       "0   1         a     a\n",
       "1   2         b     b\n",
       "2   3         b     b\n",
       "3   4         a     a\n",
       "4   5         a     a\n",
       "5   6         e     e"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"grade\"] = df[\"raw_grade\"].astype(\"category\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index([u'a', u'b', u'e'], dtype='object')"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"grade\"].cat.categories"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>raw_grade</th>\n",
       "      <th>grade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "      <td>good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>b</td>\n",
       "      <td>good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>e</td>\n",
       "      <td>very bad</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id raw_grade      grade\n",
       "0   1         a  very good\n",
       "1   2         b       good\n",
       "2   3         b       good\n",
       "3   4         a  very good\n",
       "4   5         a  very good\n",
       "5   6         e   very bad"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"grade\"].cat.categories = [\"very good\", \"good\", \"very bad\"]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>raw_grade</th>\n",
       "      <th>grade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>a</td>\n",
       "      <td>very good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>b</td>\n",
       "      <td>good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>b</td>\n",
       "      <td>good</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>e</td>\n",
       "      <td>very bad</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id raw_grade      grade\n",
       "0   1         a  very good\n",
       "3   4         a  very good\n",
       "4   5         a  very good\n",
       "1   2         b       good\n",
       "2   3         b       good\n",
       "5   6         e   very bad"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by='grade', ascending=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "grade\n",
       "very good    3\n",
       "good         2\n",
       "very bad     1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(\"grade\").size()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 画图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2000-01-01     0.416424\n",
       "2000-01-02     0.603304\n",
       "2000-01-03    -0.237965\n",
       "2000-01-04     0.317450\n",
       "2000-01-05     0.665045\n",
       "2000-01-06     2.468087\n",
       "2000-01-07     2.758852\n",
       "2000-01-08     2.271343\n",
       "2000-01-09     3.129609\n",
       "2000-01-10     5.171241\n",
       "2000-01-11     5.049896\n",
       "2000-01-12     5.185316\n",
       "2000-01-13     4.169058\n",
       "2000-01-14     2.862306\n",
       "2000-01-15     4.018617\n",
       "2000-01-16     4.456694\n",
       "2000-01-17     5.824236\n",
       "2000-01-18     6.094983\n",
       "2000-01-19     5.880954\n",
       "2000-01-20     5.875111\n",
       "2000-01-21     6.008481\n",
       "2000-01-22     6.835501\n",
       "2000-01-23     7.480405\n",
       "2000-01-24     6.849335\n",
       "2000-01-25     7.608887\n",
       "2000-01-26     9.029474\n",
       "2000-01-27     8.859222\n",
       "2000-01-28     7.162806\n",
       "2000-01-29     7.398013\n",
       "2000-01-30     7.391844\n",
       "                ...    \n",
       "2002-08-28    21.728409\n",
       "2002-08-29    21.757852\n",
       "2002-08-30    21.047643\n",
       "2002-08-31    20.114996\n",
       "2002-09-01    18.769902\n",
       "2002-09-02    17.417680\n",
       "2002-09-03    17.917688\n",
       "2002-09-04    18.064786\n",
       "2002-09-05    19.312356\n",
       "2002-09-06    18.633479\n",
       "2002-09-07    17.711879\n",
       "2002-09-08    19.162369\n",
       "2002-09-09    19.697896\n",
       "2002-09-10    18.895018\n",
       "2002-09-11    18.590989\n",
       "2002-09-12    17.278925\n",
       "2002-09-13    17.730168\n",
       "2002-09-14    19.058526\n",
       "2002-09-15    18.898382\n",
       "2002-09-16    17.048621\n",
       "2002-09-17    16.443233\n",
       "2002-09-18    16.842284\n",
       "2002-09-19    14.627031\n",
       "2002-09-20    15.500982\n",
       "2002-09-21    14.640444\n",
       "2002-09-22    13.183795\n",
       "2002-09-23    13.383657\n",
       "2002-09-24    13.006229\n",
       "2002-09-25    12.311008\n",
       "2002-09-26    11.674804\n",
       "Freq: D, dtype: float64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts = pd.Series(np.random.randn(1000), index=pd.date_range('20000101', periods=1000))\n",
    "ts = ts.cumsum()\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x85ed930>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEMCAYAAADQ553CAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXmYHGW1/78nk8xklsxknyQmZCGBEJYE0KAGzAASIgoG\nuHpRZJHlckWUCyhExJtEXAABRbx4BYQfopiLKBfhYkIAB2QVCFlMQiCQnWQm60xmn8m8vz9OH+vt\n7uru6umq7uru83meeaq6uqqrqmv6W6fOexYyxkBRFEUpHPrl+gAURVEUf1FhVxRFKTBU2BVFUQoM\nFXZFUZQCQ4VdURSlwFBhVxRFKTAyFnYiKiOi14nobSJaTUQLIsuHENEzRLSeiJYSUU3mh6soiqKk\ngvyIYyeiCmNMGxGVAHgZwDcBnAtgjzHmNiK6AcAQY8z8jHemKIqiJMUXV4wxpi0yWwagPwAD4PMA\nHoosfwjAPD/2pSiKoiTHF2Enon5E9DaAnQCWGWPeAFBrjGkAAGPMTgAj/diXoiiKkhy/LPZeY8yx\nAMYCmElER4Kt9qjV/NiXoiiKkpz+fn6YMaaZiOoBzAXQQES1xpgGIhoFoNFtGyJSwVcURekDxhhy\nW+5HVMxwiXghonIApwFYB+DPAC6OrHYRgCeSHJynvwULFviyTrrr5mq9Yt132NfLh2PMh3Pxum4h\nnbOfx5gMPyz20QAeIqJ+4BvF/xhjniai1wA8SkSXANgM4IuZ7qiurs6XddJdN1frFdq+c7XffPhu\nCulc0sHP33QhXb90143Fl3DHTCAik+tjULLDwoULsXDhwlwfhpIGK1cCw4YBY8d630avc3YgIpig\nXDGK4pUgLD4lWGbMAM45B+jpAXp7vW2j1zn3qMWuKEpCiIDp04HZs4GjjwYuuyzXR6QIySx2X6Ni\nFEUpPIiA9euBESNyfSSKV9QVoyhKUoiALVuA/ftzfSSKV1TYFUVJChGwebMKez6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hwq4o\nilJgqLAriqIUGCrsiqIoBcb/B0G72dJYXR2zAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x6141ab0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ts.plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据读写"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1.052421</td>\n",
       "      <td>-0.164992</td>\n",
       "      <td>3.098604</td>\n",
       "      <td>-0.966960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.194177</td>\n",
       "      <td>0.086880</td>\n",
       "      <td>0.496095</td>\n",
       "      <td>0.265308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.297724</td>\n",
       "      <td>1.284297</td>\n",
       "      <td>-0.130855</td>\n",
       "      <td>-0.229570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.787063</td>\n",
       "      <td>0.553680</td>\n",
       "      <td>0.546853</td>\n",
       "      <td>-0.322599</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.033174</td>\n",
       "      <td>-1.222281</td>\n",
       "      <td>0.320090</td>\n",
       "      <td>-1.749333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.109575</td>\n",
       "      <td>0.310684</td>\n",
       "      <td>1.620296</td>\n",
       "      <td>-0.928869</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.761408</td>\n",
       "      <td>-0.027630</td>\n",
       "      <td>0.458341</td>\n",
       "      <td>-0.785370</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-1.150479</td>\n",
       "      <td>-0.718584</td>\n",
       "      <td>1.028866</td>\n",
       "      <td>0.419026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-2.906881</td>\n",
       "      <td>-0.295700</td>\n",
       "      <td>-0.342306</td>\n",
       "      <td>-0.765172</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0.916363</td>\n",
       "      <td>-1.181429</td>\n",
       "      <td>-1.559657</td>\n",
       "      <td>-1.171191</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.578659</td>\n",
       "      <td>0.804726</td>\n",
       "      <td>1.299496</td>\n",
       "      <td>0.176843</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0.150659</td>\n",
       "      <td>-0.162833</td>\n",
       "      <td>-1.086055</td>\n",
       "      <td>1.240432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>-0.819219</td>\n",
       "      <td>1.668234</td>\n",
       "      <td>0.217604</td>\n",
       "      <td>-0.779170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>-0.550658</td>\n",
       "      <td>-0.672640</td>\n",
       "      <td>-0.674157</td>\n",
       "      <td>-0.637602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0.901584</td>\n",
       "      <td>0.046023</td>\n",
       "      <td>0.244370</td>\n",
       "      <td>0.374293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0.971181</td>\n",
       "      <td>-0.442618</td>\n",
       "      <td>0.179083</td>\n",
       "      <td>0.086095</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>-0.570786</td>\n",
       "      <td>-1.019239</td>\n",
       "      <td>1.684833</td>\n",
       "      <td>0.539140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>-1.432314</td>\n",
       "      <td>1.369588</td>\n",
       "      <td>2.091300</td>\n",
       "      <td>0.733526</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>-1.115526</td>\n",
       "      <td>-0.115884</td>\n",
       "      <td>2.636074</td>\n",
       "      <td>-0.788859</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1.601554</td>\n",
       "      <td>1.226182</td>\n",
       "      <td>0.169308</td>\n",
       "      <td>-0.616585</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>0.571316</td>\n",
       "      <td>0.542432</td>\n",
       "      <td>0.306595</td>\n",
       "      <td>0.780939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-0.540414</td>\n",
       "      <td>1.036656</td>\n",
       "      <td>0.683224</td>\n",
       "      <td>-0.116963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1.319110</td>\n",
       "      <td>-1.265207</td>\n",
       "      <td>1.371924</td>\n",
       "      <td>0.881560</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1.584346</td>\n",
       "      <td>-1.719633</td>\n",
       "      <td>-1.365020</td>\n",
       "      <td>-0.617224</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-0.440420</td>\n",
       "      <td>-0.799265</td>\n",
       "      <td>0.376128</td>\n",
       "      <td>-0.654581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-0.261730</td>\n",
       "      <td>-0.046325</td>\n",
       "      <td>-0.289009</td>\n",
       "      <td>0.505634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>0.385047</td>\n",
       "      <td>0.112723</td>\n",
       "      <td>0.428345</td>\n",
       "      <td>-0.008455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>-0.921668</td>\n",
       "      <td>1.609848</td>\n",
       "      <td>1.592532</td>\n",
       "      <td>-0.623103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>0.280799</td>\n",
       "      <td>-0.231821</td>\n",
       "      <td>-1.589829</td>\n",
       "      <td>-1.791286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>0.661562</td>\n",
       "      <td>0.621305</td>\n",
       "      <td>0.921586</td>\n",
       "      <td>-0.312834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>0.064385</td>\n",
       "      <td>0.669585</td>\n",
       "      <td>-1.347073</td>\n",
       "      <td>0.941348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>-1.534420</td>\n",
       "      <td>-1.227736</td>\n",
       "      <td>0.459771</td>\n",
       "      <td>-1.150254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>0.010741</td>\n",
       "      <td>0.062820</td>\n",
       "      <td>-1.098301</td>\n",
       "      <td>1.268482</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>-1.183586</td>\n",
       "      <td>1.159889</td>\n",
       "      <td>-0.186617</td>\n",
       "      <td>-0.847210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>-0.705815</td>\n",
       "      <td>-0.371896</td>\n",
       "      <td>0.313020</td>\n",
       "      <td>0.035314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>-2.945315</td>\n",
       "      <td>-0.421227</td>\n",
       "      <td>-0.403479</td>\n",
       "      <td>1.387825</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>-0.122383</td>\n",
       "      <td>0.474282</td>\n",
       "      <td>-2.039155</td>\n",
       "      <td>-0.155960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>0.921353</td>\n",
       "      <td>-0.430436</td>\n",
       "      <td>-0.599253</td>\n",
       "      <td>0.911030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>0.018444</td>\n",
       "      <td>0.098611</td>\n",
       "      <td>0.320480</td>\n",
       "      <td>0.001282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>-0.188301</td>\n",
       "      <td>-2.015690</td>\n",
       "      <td>-0.427172</td>\n",
       "      <td>-0.146939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>-0.006022</td>\n",
       "      <td>0.213421</td>\n",
       "      <td>1.358382</td>\n",
       "      <td>-0.414890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>0.596546</td>\n",
       "      <td>0.042708</td>\n",
       "      <td>1.325342</td>\n",
       "      <td>-0.800222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>-1.736245</td>\n",
       "      <td>-0.056213</td>\n",
       "      <td>-0.415892</td>\n",
       "      <td>-0.360570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>0.463591</td>\n",
       "      <td>-0.404202</td>\n",
       "      <td>0.577191</td>\n",
       "      <td>0.336023</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>-1.397557</td>\n",
       "      <td>0.442012</td>\n",
       "      <td>0.007915</td>\n",
       "      <td>-1.305628</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>-0.137766</td>\n",
       "      <td>-0.771713</td>\n",
       "      <td>0.200956</td>\n",
       "      <td>-0.365344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>0.988833</td>\n",
       "      <td>-0.165965</td>\n",
       "      <td>-0.893573</td>\n",
       "      <td>-0.318324</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>1.093799</td>\n",
       "      <td>1.694406</td>\n",
       "      <td>-0.868420</td>\n",
       "      <td>0.100202</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>-0.240628</td>\n",
       "      <td>0.539268</td>\n",
       "      <td>-1.094841</td>\n",
       "      <td>1.737569</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>1.850923</td>\n",
       "      <td>-0.472270</td>\n",
       "      <td>-2.317345</td>\n",
       "      <td>-0.544395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>0.617284</td>\n",
       "      <td>1.224130</td>\n",
       "      <td>-1.722366</td>\n",
       "      <td>0.236574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>1.282967</td>\n",
       "      <td>0.738570</td>\n",
       "      <td>1.748848</td>\n",
       "      <td>-0.106646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>0.775707</td>\n",
       "      <td>-0.494293</td>\n",
       "      <td>-1.098466</td>\n",
       "      <td>0.372206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>-0.846466</td>\n",
       "      <td>0.735144</td>\n",
       "      <td>1.456520</td>\n",
       "      <td>1.622817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>-0.860999</td>\n",
       "      <td>1.146650</td>\n",
       "      <td>-1.064013</td>\n",
       "      <td>1.400919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>-0.095498</td>\n",
       "      <td>-1.849518</td>\n",
       "      <td>2.303532</td>\n",
       "      <td>0.688425</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>-0.017921</td>\n",
       "      <td>-0.558700</td>\n",
       "      <td>-1.061605</td>\n",
       "      <td>0.781250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>-1.069070</td>\n",
       "      <td>1.106837</td>\n",
       "      <td>-1.936800</td>\n",
       "      <td>-0.782616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.436267</td>\n",
       "      <td>0.463537</td>\n",
       "      <td>0.614982</td>\n",
       "      <td>-0.123774</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.440635</td>\n",
       "      <td>-1.506836</td>\n",
       "      <td>-0.386824</td>\n",
       "      <td>1.118260</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           A         B         C         D\n",
       "0  -1.052421 -0.164992  3.098604 -0.966960\n",
       "1   1.194177  0.086880  0.496095  0.265308\n",
       "2   0.297724  1.284297 -0.130855 -0.229570\n",
       "3  -0.787063  0.553680  0.546853 -0.322599\n",
       "4   0.033174 -1.222281  0.320090 -1.749333\n",
       "5   0.109575  0.310684  1.620296 -0.928869\n",
       "6   0.761408 -0.027630  0.458341 -0.785370\n",
       "7  -1.150479 -0.718584  1.028866  0.419026\n",
       "8  -2.906881 -0.295700 -0.342306 -0.765172\n",
       "9   0.916363 -1.181429 -1.559657 -1.171191\n",
       "10  0.578659  0.804726  1.299496  0.176843\n",
       "11  0.150659 -0.162833 -1.086055  1.240432\n",
       "12 -0.819219  1.668234  0.217604 -0.779170\n",
       "13 -0.550658 -0.672640 -0.674157 -0.637602\n",
       "14  0.901584  0.046023  0.244370  0.374293\n",
       "15  0.971181 -0.442618  0.179083  0.086095\n",
       "16 -0.570786 -1.019239  1.684833  0.539140\n",
       "17 -1.432314  1.369588  2.091300  0.733526\n",
       "18 -1.115526 -0.115884  2.636074 -0.788859\n",
       "19  1.601554  1.226182  0.169308 -0.616585\n",
       "20  0.571316  0.542432  0.306595  0.780939\n",
       "21 -0.540414  1.036656  0.683224 -0.116963\n",
       "22  1.319110 -1.265207  1.371924  0.881560\n",
       "23  1.584346 -1.719633 -1.365020 -0.617224\n",
       "24 -0.440420 -0.799265  0.376128 -0.654581\n",
       "25 -0.261730 -0.046325 -0.289009  0.505634\n",
       "26  0.385047  0.112723  0.428345 -0.008455\n",
       "27 -0.921668  1.609848  1.592532 -0.623103\n",
       "28  0.280799 -0.231821 -1.589829 -1.791286\n",
       "29  0.661562  0.621305  0.921586 -0.312834\n",
       "..       ...       ...       ...       ...\n",
       "70  0.064385  0.669585 -1.347073  0.941348\n",
       "71 -1.534420 -1.227736  0.459771 -1.150254\n",
       "72  0.010741  0.062820 -1.098301  1.268482\n",
       "73 -1.183586  1.159889 -0.186617 -0.847210\n",
       "74 -0.705815 -0.371896  0.313020  0.035314\n",
       "75 -2.945315 -0.421227 -0.403479  1.387825\n",
       "76 -0.122383  0.474282 -2.039155 -0.155960\n",
       "77  0.921353 -0.430436 -0.599253  0.911030\n",
       "78  0.018444  0.098611  0.320480  0.001282\n",
       "79 -0.188301 -2.015690 -0.427172 -0.146939\n",
       "80 -0.006022  0.213421  1.358382 -0.414890\n",
       "81  0.596546  0.042708  1.325342 -0.800222\n",
       "82 -1.736245 -0.056213 -0.415892 -0.360570\n",
       "83  0.463591 -0.404202  0.577191  0.336023\n",
       "84 -1.397557  0.442012  0.007915 -1.305628\n",
       "85 -0.137766 -0.771713  0.200956 -0.365344\n",
       "86  0.988833 -0.165965 -0.893573 -0.318324\n",
       "87  1.093799  1.694406 -0.868420  0.100202\n",
       "88 -0.240628  0.539268 -1.094841  1.737569\n",
       "89  1.850923 -0.472270 -2.317345 -0.544395\n",
       "90  0.617284  1.224130 -1.722366  0.236574\n",
       "91  1.282967  0.738570  1.748848 -0.106646\n",
       "92  0.775707 -0.494293 -1.098466  0.372206\n",
       "93 -0.846466  0.735144  1.456520  1.622817\n",
       "94 -0.860999  1.146650 -1.064013  1.400919\n",
       "95 -0.095498 -1.849518  2.303532  0.688425\n",
       "96 -0.017921 -0.558700 -1.061605  0.781250\n",
       "97 -1.069070  1.106837 -1.936800 -0.782616\n",
       "98  0.436267  0.463537  0.614982 -0.123774\n",
       "99 -1.440635 -1.506836 -0.386824  1.118260\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df.to_csv('data.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Volume in drive C has no label.\n",
      " Volume Serial Number is 78AE-8B3A\n",
      "\n",
      " Directory of C:\\Users\\CNJOHUA10\\kamidox\\work\\pandas_tutor\n",
      "\n",
      "2016-03-14  11:19 AM    <DIR>          .\n",
      "2016-03-14  11:19 AM    <DIR>          ..\n",
      "2015-11-16  09:24 AM               746 .gitignore\n",
      "2016-03-14  09:53 AM    <DIR>          .ipynb_checkpoints\n",
      "2016-03-14  11:20 AM             6,466 data.csv\n",
      "2016-03-02  09:50 AM            15,291 ipython_intro.ipynb\n",
      "2016-03-02  09:50 AM            32,590 numpy_intro.ipynb\n",
      "2016-03-14  09:50 AM            80,919 pandas_intro_p1.ipynb\n",
      "2016-03-14  09:50 AM            67,298 pandas_intro_p2.ipynb\n",
      "2016-03-14  11:19 AM           108,841 pandas_intro_p3.ipynb\n",
      "2016-02-24  13:20 PM               111 README.md\n",
      "               8 File(s)        312,262 bytes\n",
      "               3 Dir(s)  88,233,422,848 bytes free\n"
     ]
    }
   ],
   "source": [
    "%ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1.052421</td>\n",
       "      <td>-0.164992</td>\n",
       "      <td>3.098604</td>\n",
       "      <td>-0.966960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.194177</td>\n",
       "      <td>0.086880</td>\n",
       "      <td>0.496095</td>\n",
       "      <td>0.265308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.297724</td>\n",
       "      <td>1.284297</td>\n",
       "      <td>-0.130855</td>\n",
       "      <td>-0.229570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.787063</td>\n",
       "      <td>0.553680</td>\n",
       "      <td>0.546853</td>\n",
       "      <td>-0.322599</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.033174</td>\n",
       "      <td>-1.222281</td>\n",
       "      <td>0.320090</td>\n",
       "      <td>-1.749333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.109575</td>\n",
       "      <td>0.310684</td>\n",
       "      <td>1.620296</td>\n",
       "      <td>-0.928869</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.761408</td>\n",
       "      <td>-0.027630</td>\n",
       "      <td>0.458341</td>\n",
       "      <td>-0.785370</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-1.150479</td>\n",
       "      <td>-0.718584</td>\n",
       "      <td>1.028866</td>\n",
       "      <td>0.419026</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-2.906881</td>\n",
       "      <td>-0.295700</td>\n",
       "      <td>-0.342306</td>\n",
       "      <td>-0.765172</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0.916363</td>\n",
       "      <td>-1.181429</td>\n",
       "      <td>-1.559657</td>\n",
       "      <td>-1.171191</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.578659</td>\n",
       "      <td>0.804726</td>\n",
       "      <td>1.299496</td>\n",
       "      <td>0.176843</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0.150659</td>\n",
       "      <td>-0.162833</td>\n",
       "      <td>-1.086055</td>\n",
       "      <td>1.240432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>-0.819219</td>\n",
       "      <td>1.668234</td>\n",
       "      <td>0.217604</td>\n",
       "      <td>-0.779170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>-0.550658</td>\n",
       "      <td>-0.672640</td>\n",
       "      <td>-0.674157</td>\n",
       "      <td>-0.637602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>0.901584</td>\n",
       "      <td>0.046023</td>\n",
       "      <td>0.244370</td>\n",
       "      <td>0.374293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0.971181</td>\n",
       "      <td>-0.442618</td>\n",
       "      <td>0.179083</td>\n",
       "      <td>0.086095</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>-0.570786</td>\n",
       "      <td>-1.019239</td>\n",
       "      <td>1.684833</td>\n",
       "      <td>0.539140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>-1.432314</td>\n",
       "      <td>1.369588</td>\n",
       "      <td>2.091300</td>\n",
       "      <td>0.733526</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>-1.115526</td>\n",
       "      <td>-0.115884</td>\n",
       "      <td>2.636074</td>\n",
       "      <td>-0.788859</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1.601554</td>\n",
       "      <td>1.226182</td>\n",
       "      <td>0.169308</td>\n",
       "      <td>-0.616585</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>0.571316</td>\n",
       "      <td>0.542432</td>\n",
       "      <td>0.306595</td>\n",
       "      <td>0.780939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-0.540414</td>\n",
       "      <td>1.036656</td>\n",
       "      <td>0.683224</td>\n",
       "      <td>-0.116963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>1.319110</td>\n",
       "      <td>-1.265207</td>\n",
       "      <td>1.371924</td>\n",
       "      <td>0.881560</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>1.584346</td>\n",
       "      <td>-1.719633</td>\n",
       "      <td>-1.365020</td>\n",
       "      <td>-0.617224</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-0.440420</td>\n",
       "      <td>-0.799265</td>\n",
       "      <td>0.376128</td>\n",
       "      <td>-0.654581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-0.261730</td>\n",
       "      <td>-0.046325</td>\n",
       "      <td>-0.289009</td>\n",
       "      <td>0.505634</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>0.385047</td>\n",
       "      <td>0.112723</td>\n",
       "      <td>0.428345</td>\n",
       "      <td>-0.008455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>-0.921668</td>\n",
       "      <td>1.609848</td>\n",
       "      <td>1.592532</td>\n",
       "      <td>-0.623103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>0.280799</td>\n",
       "      <td>-0.231821</td>\n",
       "      <td>-1.589829</td>\n",
       "      <td>-1.791286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>0.661562</td>\n",
       "      <td>0.621305</td>\n",
       "      <td>0.921586</td>\n",
       "      <td>-0.312834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>0.064385</td>\n",
       "      <td>0.669585</td>\n",
       "      <td>-1.347073</td>\n",
       "      <td>0.941348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>-1.534420</td>\n",
       "      <td>-1.227736</td>\n",
       "      <td>0.459771</td>\n",
       "      <td>-1.150254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>0.010741</td>\n",
       "      <td>0.062820</td>\n",
       "      <td>-1.098301</td>\n",
       "      <td>1.268482</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>-1.183586</td>\n",
       "      <td>1.159889</td>\n",
       "      <td>-0.186617</td>\n",
       "      <td>-0.847210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>-0.705815</td>\n",
       "      <td>-0.371896</td>\n",
       "      <td>0.313020</td>\n",
       "      <td>0.035314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>-2.945315</td>\n",
       "      <td>-0.421227</td>\n",
       "      <td>-0.403479</td>\n",
       "      <td>1.387825</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>-0.122383</td>\n",
       "      <td>0.474282</td>\n",
       "      <td>-2.039155</td>\n",
       "      <td>-0.155960</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>0.921353</td>\n",
       "      <td>-0.430436</td>\n",
       "      <td>-0.599253</td>\n",
       "      <td>0.911030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>0.018444</td>\n",
       "      <td>0.098611</td>\n",
       "      <td>0.320480</td>\n",
       "      <td>0.001282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>-0.188301</td>\n",
       "      <td>-2.015690</td>\n",
       "      <td>-0.427172</td>\n",
       "      <td>-0.146939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>-0.006022</td>\n",
       "      <td>0.213421</td>\n",
       "      <td>1.358382</td>\n",
       "      <td>-0.414890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>0.596546</td>\n",
       "      <td>0.042708</td>\n",
       "      <td>1.325342</td>\n",
       "      <td>-0.800222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>-1.736245</td>\n",
       "      <td>-0.056213</td>\n",
       "      <td>-0.415892</td>\n",
       "      <td>-0.360570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>0.463591</td>\n",
       "      <td>-0.404202</td>\n",
       "      <td>0.577191</td>\n",
       "      <td>0.336023</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>-1.397557</td>\n",
       "      <td>0.442012</td>\n",
       "      <td>0.007915</td>\n",
       "      <td>-1.305628</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>-0.137766</td>\n",
       "      <td>-0.771713</td>\n",
       "      <td>0.200956</td>\n",
       "      <td>-0.365344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>0.988833</td>\n",
       "      <td>-0.165965</td>\n",
       "      <td>-0.893573</td>\n",
       "      <td>-0.318324</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>1.093799</td>\n",
       "      <td>1.694406</td>\n",
       "      <td>-0.868420</td>\n",
       "      <td>0.100202</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>-0.240628</td>\n",
       "      <td>0.539268</td>\n",
       "      <td>-1.094841</td>\n",
       "      <td>1.737569</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>1.850923</td>\n",
       "      <td>-0.472270</td>\n",
       "      <td>-2.317345</td>\n",
       "      <td>-0.544395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>0.617284</td>\n",
       "      <td>1.224130</td>\n",
       "      <td>-1.722366</td>\n",
       "      <td>0.236574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>1.282967</td>\n",
       "      <td>0.738570</td>\n",
       "      <td>1.748848</td>\n",
       "      <td>-0.106646</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>0.775707</td>\n",
       "      <td>-0.494293</td>\n",
       "      <td>-1.098466</td>\n",
       "      <td>0.372206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>-0.846466</td>\n",
       "      <td>0.735144</td>\n",
       "      <td>1.456520</td>\n",
       "      <td>1.622817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>-0.860999</td>\n",
       "      <td>1.146650</td>\n",
       "      <td>-1.064013</td>\n",
       "      <td>1.400919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>-0.095498</td>\n",
       "      <td>-1.849518</td>\n",
       "      <td>2.303532</td>\n",
       "      <td>0.688425</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>-0.017921</td>\n",
       "      <td>-0.558700</td>\n",
       "      <td>-1.061605</td>\n",
       "      <td>0.781250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>-1.069070</td>\n",
       "      <td>1.106837</td>\n",
       "      <td>-1.936800</td>\n",
       "      <td>-0.782616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>0.436267</td>\n",
       "      <td>0.463537</td>\n",
       "      <td>0.614982</td>\n",
       "      <td>-0.123774</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>-1.440635</td>\n",
       "      <td>-1.506836</td>\n",
       "      <td>-0.386824</td>\n",
       "      <td>1.118260</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           A         B         C         D\n",
       "0  -1.052421 -0.164992  3.098604 -0.966960\n",
       "1   1.194177  0.086880  0.496095  0.265308\n",
       "2   0.297724  1.284297 -0.130855 -0.229570\n",
       "3  -0.787063  0.553680  0.546853 -0.322599\n",
       "4   0.033174 -1.222281  0.320090 -1.749333\n",
       "5   0.109575  0.310684  1.620296 -0.928869\n",
       "6   0.761408 -0.027630  0.458341 -0.785370\n",
       "7  -1.150479 -0.718584  1.028866  0.419026\n",
       "8  -2.906881 -0.295700 -0.342306 -0.765172\n",
       "9   0.916363 -1.181429 -1.559657 -1.171191\n",
       "10  0.578659  0.804726  1.299496  0.176843\n",
       "11  0.150659 -0.162833 -1.086055  1.240432\n",
       "12 -0.819219  1.668234  0.217604 -0.779170\n",
       "13 -0.550658 -0.672640 -0.674157 -0.637602\n",
       "14  0.901584  0.046023  0.244370  0.374293\n",
       "15  0.971181 -0.442618  0.179083  0.086095\n",
       "16 -0.570786 -1.019239  1.684833  0.539140\n",
       "17 -1.432314  1.369588  2.091300  0.733526\n",
       "18 -1.115526 -0.115884  2.636074 -0.788859\n",
       "19  1.601554  1.226182  0.169308 -0.616585\n",
       "20  0.571316  0.542432  0.306595  0.780939\n",
       "21 -0.540414  1.036656  0.683224 -0.116963\n",
       "22  1.319110 -1.265207  1.371924  0.881560\n",
       "23  1.584346 -1.719633 -1.365020 -0.617224\n",
       "24 -0.440420 -0.799265  0.376128 -0.654581\n",
       "25 -0.261730 -0.046325 -0.289009  0.505634\n",
       "26  0.385047  0.112723  0.428345 -0.008455\n",
       "27 -0.921668  1.609848  1.592532 -0.623103\n",
       "28  0.280799 -0.231821 -1.589829 -1.791286\n",
       "29  0.661562  0.621305  0.921586 -0.312834\n",
       "..       ...       ...       ...       ...\n",
       "70  0.064385  0.669585 -1.347073  0.941348\n",
       "71 -1.534420 -1.227736  0.459771 -1.150254\n",
       "72  0.010741  0.062820 -1.098301  1.268482\n",
       "73 -1.183586  1.159889 -0.186617 -0.847210\n",
       "74 -0.705815 -0.371896  0.313020  0.035314\n",
       "75 -2.945315 -0.421227 -0.403479  1.387825\n",
       "76 -0.122383  0.474282 -2.039155 -0.155960\n",
       "77  0.921353 -0.430436 -0.599253  0.911030\n",
       "78  0.018444  0.098611  0.320480  0.001282\n",
       "79 -0.188301 -2.015690 -0.427172 -0.146939\n",
       "80 -0.006022  0.213421  1.358382 -0.414890\n",
       "81  0.596546  0.042708  1.325342 -0.800222\n",
       "82 -1.736245 -0.056213 -0.415892 -0.360570\n",
       "83  0.463591 -0.404202  0.577191  0.336023\n",
       "84 -1.397557  0.442012  0.007915 -1.305628\n",
       "85 -0.137766 -0.771713  0.200956 -0.365344\n",
       "86  0.988833 -0.165965 -0.893573 -0.318324\n",
       "87  1.093799  1.694406 -0.868420  0.100202\n",
       "88 -0.240628  0.539268 -1.094841  1.737569\n",
       "89  1.850923 -0.472270 -2.317345 -0.544395\n",
       "90  0.617284  1.224130 -1.722366  0.236574\n",
       "91  1.282967  0.738570  1.748848 -0.106646\n",
       "92  0.775707 -0.494293 -1.098466  0.372206\n",
       "93 -0.846466  0.735144  1.456520  1.622817\n",
       "94 -0.860999  1.146650 -1.064013  1.400919\n",
       "95 -0.095498 -1.849518  2.303532  0.688425\n",
       "96 -0.017921 -0.558700 -1.061605  0.781250\n",
       "97 -1.069070  1.106837 -1.936800 -0.782616\n",
       "98  0.436267  0.463537  0.614982 -0.123774\n",
       "99 -1.440635 -1.506836 -0.386824  1.118260\n",
       "\n",
       "[100 rows x 4 columns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# pd.read_csv('data.csv')\n",
    "pd.read_csv('data.csv', index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
